interface Strategy {
    doSomething(): void
}

class ConcreateStrategy1 implements Strategy {
    doSomething(): void {
        console.log("using ConcreateStrategy1");
    }
}


class ConcreateStrategy2 implements Strategy {
    doSomething(): void {
        console.log("using ConcreateStrategy2");
    }
}

class SpecificContext {
    private _strategy: Strategy;

    constructor(stratge: Strategy) {
        this._strategy = stratge
    }

    public get strategy(): Strategy {
        return this._strategy;
    }
    public set strategy(value: Strategy) {
        this._strategy = value;
    }

    public doOperation(): void {
        this._strategy.doSomething()
    }
}

const StrategyTest = (): void => {
    const strategy1: Strategy = new ConcreateStrategy1()
    const strategy2: Strategy = new ConcreateStrategy2()
    const context: SpecificContext = new SpecificContext(strategy1)
    context.doOperation()
    context.strategy = strategy2
    context.doOperation()
}

StrategyTest()